/*
 * Copyright 2008 M-Way Solutions
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mwaysolutions.ocm;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 *
 * @author <a href="mailto:m.zdila@mwaysolutions.com">Martin Ždila</a>
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Inherited
public @interface OcmProperty {

  /**
   * Name of the JCR property (including namespace).
   * If ommited, the property name is derived from package namespace and getter/setter name.
   */
  String name() default "";

  /** Property is reference rather than a child JCR Node */
  boolean reference() default false;

//  /** property is write mandatory according to JSR-170 */
//  boolean mandatory() default true;

  /** property is write protected according to JSR-170 */
  boolean writeProtected() default false;

  /** property is autocreated according to JSR-170 */
  boolean autocreated() default false;

  /**
   * Indicate to use name of such annotated method only for getter / setter.
   * This is used to annotate getter and setter if have different names for the same JCR property named with {@link OcmProperty#name()}
   */
  boolean partial() default false;

  /** indicate that value is unique within collection */
  boolean unique() default false;

}
